package com.training.java.core.polymorphism;

public class RaceCar extends Car {

	private boolean nitro;
	
	public RaceCar(){
		super();
	}
	
	RaceCar(int year, String make, String model, boolean nitro){
		
		super(make,model,year); //this is how we initialize our make,model and year from the car class by calling super constructor.
		
		this.nitro=nitro; // this is how we initialize nitro feature in this subclass race car.
	}
	
	
	
	void race() {

		System.out.println("I am racing.");
		accelerate(getMaximumSpeed());

	}
	//in race care and police car,we override some of them from super class.
void start(){
		
		super.start(); // if we call super class constructor or super class method then we use super
		
		
		super.accelerate(20);  // if we call any method of our super class then for ex.accelerate
		
		System.out.println("I am starting my race Car... rumm....!");
	}
		int accelerate(int howMuch) {
			
			return super.accelerate(howMuch + 50);
		}

}
